#pragma once

#include "RenderScene.h"

#include "VulkanDirectionalLights.h"
#include "VulkanPointLights.h"
#include "VulkanSpotLights.h"
#include "VulkanMeshInstances.h"
#include "Render/Scene/PreRenderScene.h"

class CVulkanViewportWidget;

class CVulkanScene
{
public:
    CVulkanScene();

    void BindData(const CPreRenderScene& InData);

    void PreProcess(CVulkanViewportWidget* InViewport);

    void RecordCommand(
        vk::CommandBuffer InCommandBuffer
        ,vk::Extent2D InViewportSize
        ,SSceneParameters& InParameters
        ,const SFrustumPoints& InFrustumPoints
        ,CDefferRenderAttachments* Attachments
        ) ;

    CVulkanMeshInstances* GetMeshInstancePainter()
    {
        return &MeshInstancePainter;
    }

    CVulkanSpotLights* GetSpotLightPainter()
    {
        return &SpotLightPainter;
    }

    CVulkanPointLights* GetPointLightPainter()
    {
        return &PointLightPainter;
    }

    CVulkanDirectionalLights* GetDirectionalLightPainter()
    {
        return &DirectionalLightPainter;
    }
protected:
    CPreRenderScene Data;
    
    CVulkanMeshInstances MeshInstancePainter;
    CVulkanSpotLights SpotLightPainter;
    CVulkanPointLights PointLightPainter;
    CVulkanDirectionalLights DirectionalLightPainter;
    std::shared_ptr<CSceneParameterBuffer> SceneParameterBuffer;
};

//绘制场景
class CVulkanScenes
{
public:
    void PreProcess(
        const TVector<CPreRenderScene>& InScenes,
        CVulkanViewportWidget* InViewport
    );

    void RecordCommand(vk::CommandBuffer InCommandBuffer
        ,vk::Extent2D InViewportSize
        ,SSceneParameters& InParameters
        ,const SFrustumPoints& InFrustumPoints
        ,CDefferRenderAttachments* Attachments);

protected:
    TVector<CVulkanScene> Scenes;

};